const express = require('express')

const router = express.Router()

const schema = require('../schema/bigAdmin')
const expressJoi = require('@escook/express-joi')


//导入multer和path,解析form-data的数据，就是上传文件和图片有关

// 导入解析formdata格式表单数据包
const multer = require('multer')
//导入处理路径的核心模块
const path = require('path')
var storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null, path.join(__dirname, '../upload'))
    },
    filename: function (req, file, cb) {
        cb(null, file.originalname)
    }
})
var upload = multer({ storage: storage })

const bigAdmin_handle = require('../router_handle/bigAdmin')


//获取二级学院的信息
router.get('/get_collegeName', bigAdmin_handle.get_collegeName)

//获取个人信息
router.get('/get_bigAdminInfo', bigAdmin_handle.get_bigAdminInfo)

// 获取所有学生信息
router.get('/get_studentAllInfo', bigAdmin_handle.get_studentAllInfo)


// 获取所有教师信息
router.get('/get_teacherAllInfo', bigAdmin_handle.get_teacherAllInfo)


//获取所有学生的毕业设计情况
router.get('/get_allPaper', bigAdmin_handle.get_allPaper)


//修改个人信息
router.post('/update_info', expressJoi(schema.bigAdmin_schema), bigAdmin_handle.update_info)

//修改密码
router.post('/update_pwd', expressJoi(schema.bigAdminPwd_schema), bigAdmin_handle.update_pwd)

//获取教师提交的课题
router.get('/get_topic', bigAdmin_handle.teacher_topic)

//通过教师提交的课题
router.post('/pass_topic', bigAdmin_handle.pass_topic)

//获取本学院的教师信息
router.get('/get_collageteacher', bigAdmin_handle.get_collageteacher)

//添加评阅小组
router.post('/insert_group', bigAdmin_handle.insert_group)

//给开题答辩小组组长
router.post('/get_groupTeacher', bigAdmin_handle.get_groupTeacher)

//毕业小组组长
router.post('/groupteacher', bigAdmin_handle.groupteacher)

//能够参加开题答辩的学生
router.post('/get_studentreportinfo', bigAdmin_handle.get_studentreportinfo)

//已经分配开题答辩的学生
router.post('/distribution_studentinfo', bigAdmin_handle.distribution_studentinfo)

//获取能够参与论文答辩的学生信息
router.post('/get_studentPaperinfo', bigAdmin_handle.get_studentPaperinfo)

//查看已经分配毕业答辩的学生
router.post('/distribution_paperinfo', bigAdmin_handle.distribution_paperinfo)

//获取可以分配评阅教授的学生
router.post('/lookTeacher_student', bigAdmin_handle.lookTeacher_student)

//获取学院的教师信息
router.post('/get_collageteachers', bigAdmin_handle.get_collageteachers)

//获取评阅教师信息
router.post('/insert_lookTeacher', bigAdmin_handle.insert_lookTeacher)

//获取二级管理员信息
router.post('/secondaryInfo', bigAdmin_handle.secondaryInfo)

//删除二级管理员
router.post('/dele_secondaryInfo', bigAdmin_handle.dele_secondaryInfo)

//获取二级管理员密码
router.post('/get_secondaryInfopwd', bigAdmin_handle.get_secondaryInfopwd)

//修改二级管理员密码
router.post('/update_secondaryInfopwd', bigAdmin_handle.update_secondaryInfopwd)

//添加二级管理员
router.post('/add_secondaryInfo', bigAdmin_handle.add_secondaryInfo)

//查看二级管理员
router.post('/see_secondaryInfo', bigAdmin_handle.see_secondaryInfo)

// //导入学院
router.post('/insert_file', upload.single('file'), bigAdmin_handle.insert_file)

//删除学生
router.post('/dele_studentinfo', bigAdmin_handle.dele_studentinfo)

//添加学生
router.post('/add_studentInfo', bigAdmin_handle.add_studentInfo)

//添加教师
router.post('/add_teacherInfo', bigAdmin_handle.add_teacherInfo)

//删除教师
router.post('/dele_teacherInfo', bigAdmin_handle.dele_teacherinfo)

module.exports = router